# 断言工具
def assert_response(response, expected):
    """
    断言响应结果
    :param response: 实际响应
    :param expected: 预期结果 {code: 200, message: "success"}
    """
    assert response.status_code == expected["code"], \
        f"状态码错误！实际: {response.status_code}, 预期: {expected['code']}"

    response_json = response.json()
    assert response_json["message"] == expected["message"], \
        f"返回消息错误！实际: {response_json['message']}, 预期: {expected['message']}"